(completion-setup-function): Compute the common parts
authorEli Zaretskii <eliz@gnu.org>
Fri, 23 Jul 2004 11:52:03 +0000 (11:52 +0000)
committerEli Zaretskii <eliz@gnu.org>
Fri, 23 Jul 2004 11:52:03 +0000 (11:52 +0000)
and the first difference place correctly when
partial-completion-mode is on.

lisp/simple.el

index 9d61a3905755eb20ade3f0c298ee8f4e1f0e1a58..1e112b1be74f3f124b0ec1c3428fbf23529346d2 100644 (file)
@@ -4313,6 +4313,13 @@ of the differing parts is, by contrast, slightly highlighted."
     (if minibuffer-completing-file-name
        (with-current-buffer mainbuf
          (setq default-directory (file-name-directory mbuf-contents))))
+    ;; If partial-completion-mode is on, point might not be after the
+    ;; last character in the minibuffer.
+    ;; FIXME: This still doesn't work if the text to be completed
+    ;; starts with a `-'.
+    (when (and partial-completion-mode (not (eobp)))
+      (setq mbuf-contents
+           (substring mbuf-contents 0 (- (point) (point-max)))))
     (with-current-buffer standard-output
       (completion-list-mode)
       (make-local-variable 'completion-reference-buffer)